import QtQuick

import QtQuick.Controls//引入控件库，需要button等控件

Window {   
    id: mainWindow
    width: 640
    height: 480
    visible: true
    title: qsTr("DDConnect")

    Mqtt_page{
    id:m_mqttpage
    }

    Udp_page{
    id:m_udppage
    }

    Tcp_page{
    id:m_tcppage
    }

    Rectangle{
    id:mqtt
    anchors.topMargin: 10
    height: 80
    width: 120
    Button{
        anchors.fill: parent
        onClicked: {
        mainWindow.hide();
        m_mqttpage.show();
        }
    }
    Text {
        anchors.centerIn: parent
        font.pointSize: 15
        id: text_mqtt
        text: qsTr("MQTT测试")
    }

    }

    Rectangle{//tcp测试，点击进入tcp测试
    id:tcp
    anchors.top: mqtt.bottom
    anchors.topMargin: 10
    height: 80
    width: 120
    color: "blue"
    Button{
        anchors.fill: parent
        onClicked: {
        mainWindow.hide();
        m_tcppage.show();
        }
    }
    Text {
        anchors.centerIn: parent
        font.pointSize: 15
        id: text_TCP
        text: qsTr("TCP测试")
        }
    }

    Rectangle{//udp测试，点击进入udp测试
    id:udp
    anchors.top: tcp.bottom
    anchors.topMargin: 10
    height: 80
    width: 120
    color: "blue"
    Button{
        anchors.fill: parent
        onClicked: {
        mainWindow.hide();
        m_udppage.show();
        }
    }
    Text {
        anchors.centerIn: parent
        font.pointSize: 15
        id: text_UDP
        text: qsTr("UDP测试")
        }
    }


    Component.onDestruction: {
           // 如果子窗体是顶层窗口，确保它们也被关闭
            console.log("here");
            //console.log(m_mqttpage.close);

            m_mqttpage.close();
           // m_udppage.close();
           // m_tcppage.close();
       }


}
